<template>
  <div class='container'>
    <el-dialog title="预览文章" :visible="ashowDialog" @close="btnCancel">
      <!-- 标题 -->
      <h2>{{this.formData.title}}</h2>
      <div class="tm">
        <!-- 时间 -->
        <span class="details">
            {{this.formData.createTime|formatDate("yyyy-MM-dd hh:mm:ss")}}
          </span>
          <!-- 录入人 -->
          <span class="details">超级管理员</span>
          <!-- 浏览量 -->
          <i class="el-icon-view details"></i><span class="details">{{this.formData.visits}}</span>
        </div>
        <!-- 正文 -->
      <div class="information" v-html="this.formData.articleBody"></div>
    </el-dialog>
  </div>
</template>

<script>
import { detail } from '@/api/hmmm/articles.js'
export default {
  props: {
    ashowDialog: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      formData: ''
    }
  },
  methods: {
    btnCancel () {
      this.$emit('update:ashowDialog', false)
    },
    // 获取获取详情
    async preview (id) {
      const { data } = await detail({ id })
      this.formData = data
      console.log(this.formData)
    }
  }
}
</script>

<style scoped>
.details {
  display: inline-block;
  margin-right: 10px;
}
.tm {
  padding-left: 10px;
}
.information {
  background-color: rgb(248, 240, 240);
  border-radius: 20px;
  margin-top: 10px;
  padding: 10px;
}
</style>
